﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Events - Event Handling</title>
    <script src="script/jquery-1.3.2.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function() {
            $("#old").click(function() {
                $("input").trigger("focus");
            });
            $("#new").click(function() {
                $("input").triggerHandler("focus");
            });
            $("input").focus(function() {
                $("<span>Focused!</span>").appendTo("body").fadeOut(1000);
            }); 
        });
    </script>
</head>
<body>
    <button id="old">.trigger("focus")</button> 
    <button id="new">.triggerHandler("focus")</button><br/><br/> 

    <input type="text" value="To Be Focused"/>
</body>
</html>
